From 66939bab93cdcb9b7732c45d7bc3b99b6951fe15 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Wed, 7 Oct 2026 19:17:14 +0200 Subject: feat: promote a reference as the primary shown in lists Add an is_primary flag to references; the promoted ref sorts first on the item page and is the one shown under the item in the list and catalog. Item page gets a star toggle per reference. --- src/routes/grocery/[id]/+page.svelte | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/routes/grocery/[id]/+page.svelte') diff --git a/src/routes/grocery/[id]/+page.svelte b/src/routes/grocery/[id]/+page.svelte index 027c079..1a9aac8 100644 --- a/src/routes/grocery/[id]/+page.svelte +++ b/src/routes/grocery/[id]/+page.svelte @@ -156,6 +156,9 @@ {#each data?.references ?? [] as ref (ref.id)}
+ {#if ref.isPrimary} + ★ + {/if} {ref.reference} {#if ref.price} Note : {ref.qualityScore}/100 {/if}
+ {#if !ref.isPrimary} + + {/if} @@ -226,6 +239,30 @@ font-weight: 500; } + .primary-badge { + color: var(--accent); + font-size: 0.875rem; + } + + .promote-btn { + flex-shrink: 0; + width: 2rem; + aspect-ratio: 1; + padding: 0; + background: transparent; + border: none; + color: var(--text-secondary); + font-size: 1.25rem; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + } + + .promote-btn:hover { + color: var(--accent); + } + .error { margin-top: -0.25rem; margin-bottom: 0.5rem; -- cgit v1.3